using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;

using ILRuntime.CLR.TypeSystem;
using ILRuntime.CLR.Method;
using ILRuntime.Runtime.Enviorment;
using ILRuntime.Runtime.Intepreter;
using ILRuntime.Runtime.Stack;
using ILRuntime.Reflection;
using ILRuntime.CLR.Utils;
using System.Linq;

namespace ILRuntime.Runtime.Generated
{
    unsafe class huqiang_UIComposite_Composite_Binding
    {
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase method;
            FieldInfo field;
            Type[] args;
            Type type = typeof(huqiang.UIComposite.Composite);
            args = new Type[]{typeof(huqiang.Data.FakeStruct), typeof(huqiang.Core.HGUI.UIElement), typeof(huqiang.Core.HGUI.UIInitializer)};
            method = type.GetMethod("Initial", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Initial_0);
            args = new Type[]{typeof(System.Single)};
            method = type.GetMethod("Update", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Update_1);

            field = type.GetField("BufferData", flag);
            app.RegisterCLRFieldGetter(field, get_BufferData_0);
            app.RegisterCLRFieldSetter(field, set_BufferData_0);
            app.RegisterCLRFieldBinding(field, CopyToStack_BufferData_0, AssignFromStack_BufferData_0);
            field = type.GetField("Enity", flag);
            app.RegisterCLRFieldGetter(field, get_Enity_1);
            app.RegisterCLRFieldSetter(field, set_Enity_1);
            app.RegisterCLRFieldBinding(field, CopyToStack_Enity_1, AssignFromStack_Enity_1);
            field = type.GetField("Frame", flag);
            app.RegisterCLRFieldGetter(field, get_Frame_2);
            app.RegisterCLRFieldSetter(field, set_Frame_2);
            app.RegisterCLRFieldBinding(field, CopyToStack_Frame_2, AssignFromStack_Frame_2);


            app.RegisterCLRCreateArrayInstance(type, s => new huqiang.UIComposite.Composite[s]);


        }


        static StackObject* Initial_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 4);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            huqiang.Core.HGUI.UIInitializer @initializer = (huqiang.Core.HGUI.UIInitializer)typeof(huqiang.Core.HGUI.UIInitializer).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            huqiang.Core.HGUI.UIElement @element = (huqiang.Core.HGUI.UIElement)typeof(huqiang.Core.HGUI.UIElement).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            huqiang.Data.FakeStruct @mod = (huqiang.Data.FakeStruct)typeof(huqiang.Data.FakeStruct).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 4);
            huqiang.UIComposite.Composite instance_of_this_method = (huqiang.UIComposite.Composite)typeof(huqiang.UIComposite.Composite).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.Initial(@mod, @element, @initializer);

            return __ret;
        }

        static StackObject* Update_1(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Single @time = *(float*)&ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            huqiang.UIComposite.Composite instance_of_this_method = (huqiang.UIComposite.Composite)typeof(huqiang.UIComposite.Composite).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.Update(@time);

            return __ret;
        }


        static object get_BufferData_0(ref object o)
        {
            return ((huqiang.UIComposite.Composite)o).BufferData;
        }

        static StackObject* CopyToStack_BufferData_0(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.UIComposite.Composite)o).BufferData;
            object obj_result_of_this_method = result_of_this_method;
            if(obj_result_of_this_method is CrossBindingAdaptorType)
            {    
                return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance);
            }
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_BufferData_0(ref object o, object v)
        {
            ((huqiang.UIComposite.Composite)o).BufferData = (huqiang.Data.FakeStruct)v;
        }

        static StackObject* AssignFromStack_BufferData_0(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            huqiang.Data.FakeStruct @BufferData = (huqiang.Data.FakeStruct)typeof(huqiang.Data.FakeStruct).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            ((huqiang.UIComposite.Composite)o).BufferData = @BufferData;
            return ptr_of_this_method;
        }

        static object get_Enity_1(ref object o)
        {
            return ((huqiang.UIComposite.Composite)o).Enity;
        }

        static StackObject* CopyToStack_Enity_1(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.UIComposite.Composite)o).Enity;
            object obj_result_of_this_method = result_of_this_method;
            if(obj_result_of_this_method is CrossBindingAdaptorType)
            {    
                return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance);
            }
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_Enity_1(ref object o, object v)
        {
            ((huqiang.UIComposite.Composite)o).Enity = (huqiang.Core.HGUI.UIElement)v;
        }

        static StackObject* AssignFromStack_Enity_1(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            huqiang.Core.HGUI.UIElement @Enity = (huqiang.Core.HGUI.UIElement)typeof(huqiang.Core.HGUI.UIElement).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            ((huqiang.UIComposite.Composite)o).Enity = @Enity;
            return ptr_of_this_method;
        }

        static object get_Frame_2(ref object o)
        {
            return ((huqiang.UIComposite.Composite)o).Frame;
        }

        static StackObject* CopyToStack_Frame_2(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.UIComposite.Composite)o).Frame;
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method;
            return __ret + 1;
        }

        static void set_Frame_2(ref object o, object v)
        {
            ((huqiang.UIComposite.Composite)o).Frame = (System.Int32)v;
        }

        static StackObject* AssignFromStack_Frame_2(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Int32 @Frame = ptr_of_this_method->Value;
            ((huqiang.UIComposite.Composite)o).Frame = @Frame;
            return ptr_of_this_method;
        }




    }
}
